package com.isdepci.project.carbon.controller;

import com.isdepci.common.utils.poi.ExcelUtil;
import com.isdepci.framework.aspectj.lang.annotation.Log;
import com.isdepci.framework.aspectj.lang.enums.BusinessType;
import com.isdepci.framework.web.controller.BaseController;
import com.isdepci.framework.web.domain.AjaxResult;
import com.isdepci.framework.web.page.TableDataInfo;
import com.isdepci.project.carbon.domain.BWeldHeatEmissionParameter;
import com.isdepci.project.carbon.service.IBWeldHeatEmissionParameterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 切焊加热Controller
 *
 * @author isdepci
 * @date 2025-03-29
 */
@RestController
@RequestMapping("/weldHeat/parameter")
public class BWeldHeatEmissionParameterController extends BaseController
{
    @Autowired
    private IBWeldHeatEmissionParameterService bWeldHeatEmissionParameterService;

    /**
     * 查询切焊加热列表
     */
    //  @PreAuthorize("@ss.hasPermi('weldHeat:parameter:list')")
    @GetMapping("/list")
    public TableDataInfo list(BWeldHeatEmissionParameter bWeldHeatEmissionParameter)
    {
        startPage();
        List<BWeldHeatEmissionParameter> list = bWeldHeatEmissionParameterService.selectBWeldHeatEmissionParameterList(bWeldHeatEmissionParameter);
        return getDataTable(list);
    }

    /**
     * 导出切焊加热列表
     */
    //  @PreAuthorize("@ss.hasPermi('weldHeat:parameter:export')")
    @Log(title = "切焊加热", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(BWeldHeatEmissionParameter bWeldHeatEmissionParameter)
    {
        List<BWeldHeatEmissionParameter> list = bWeldHeatEmissionParameterService.selectBWeldHeatEmissionParameterList(bWeldHeatEmissionParameter);
        ExcelUtil<BWeldHeatEmissionParameter> util = new ExcelUtil<BWeldHeatEmissionParameter>(BWeldHeatEmissionParameter.class);
        return util.exportExcel(list, "parameter");
    }

    /**
     * 获取切焊加热详细信息
     */
    //  @PreAuthorize("@ss.hasPermi('weldHeat:parameter:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(bWeldHeatEmissionParameterService.selectBWeldHeatEmissionParameterById(id));
    }

    /**
     * 新增切焊加热
     */
    //  @PreAuthorize("@ss.hasPermi('weldHeat:parameter:add')")
    @Log(title = "切焊加热", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BWeldHeatEmissionParameter bWeldHeatEmissionParameter)
    {
        return toAjax(bWeldHeatEmissionParameterService.insertBWeldHeatEmissionParameter(bWeldHeatEmissionParameter));
    }

    /**
     * 修改切焊加热
     */
    //  @PreAuthorize("@ss.hasPermi('weldHeat:parameter:edit')")
    @Log(title = "切焊加热", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BWeldHeatEmissionParameter bWeldHeatEmissionParameter)
    {
        return toAjax(bWeldHeatEmissionParameterService.updateBWeldHeatEmissionParameter(bWeldHeatEmissionParameter));
    }

    /**
     * 删除切焊加热
     */
    //  @PreAuthorize("@ss.hasPermi('weldHeat:parameter:remove')")
    @Log(title = "切焊加热", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(bWeldHeatEmissionParameterService.deleteBWeldHeatEmissionParameterByIds(ids));
    }
}
